The software interrupt calls

ax=1 – Read Character From the Active Window Inputs: cx,dx (long) = logical byte number Outputs: ax = character read (0 if byte number is out of range) Function: This call reads the logical byte indicated from the file in the target window and returns it.

ax=2 – Get Span of Characters From the Active Window Inputs: cx,dx (long) = logical byte number

Outputs: ax = 1 => EOF; 0 => not EOF cx,dx (far) = first byte of the span si,di (far) = last byte of the span Function: keeps the file characters in sequences of varying length (depending on what editing has taken place) in memory buffers. This call gets a pointer to the designated character and all characters following it in the buffer. This call also gets a span from the target window. If the file has not been edited at all, you will get a pointer to 1024 characters. It is faster to use this call than call ax=1, since one call ax=2 gets you a pointer to a number of characters. Warning: These pointers are only valid until you make ANY other call on . If you make another call, assume that these pointers are no longer valid.

ax=3 – Top or Bottom the Active Window Inputs: bx = 0 => top window 1 => top/bottom window 2 => bottom window 3 => swap the two top windows Outputs: None Function: The active window is changed to be the top or bottom window (or the two top windows are interchanged).

ax=4 – Scroll the Active Window Inputs: bx = 0 => scroll up 1 => scroll down cx = number of lines to scroll

Outputs: None Function: The active window is scrolled up or down by the designated number of lines.

ax=5 – Change the Active Window Inputs: bx = window identifier of the new target window Outputs: ax = 0 => command completed normally; 1 => invalid window identifier Function: Changes the the active window

ax=6 – Change Selection Inputs: bx = 0 => only select the text 1 => select the text and scroll the window so that the text shows in the window 2 => select and delete the designated text (the new selection will be the first character after the deleted characters. cx,dx (long) = logical byte number of the first byte of the selection si,di (long) = logical byte number of the last byte of the selection Outputs: None Function: This command sets the selection.

ax=7 – Redraw the Screen Inputs: None Outputs: None

Function: The screen is redrawn. will not update the screen in many cases when you call these functions. It is up to you to ask for the screen to be updated. This will save time by avoiding a screen update when you do not need the screen updated.

ax=8 – Insert Character (in front of the selection) Inputs: bx = character to insert Outputs: None Function: The character is inserted into the file just in front of the selection. The new selection is the first character of the old selection.

ax=9 – Delete the Selected Characters Inputs: None Outputs: None Function: the selected characters are deleted. The new selection is the first character after the deleted characters.

ax=10 – Display Message On Message Line Inputs: bx = 0 => erase sticky message 1=> normal message 2 => message in the prompt color 3 => message in the error color (and wait for character to be typed) 4 => sticky message 5 => message on the line above the message line. cx,dx (far) = address of the message string Outputs: None Function: A message is displayed to the user. Normal messages (types 1, 2 and 3) are erased when the next user command is issued or when the screen is redrawn. Sticky messages (type 4) stay until they are explicitly erased. Normal messages come in the normal, prompt and error colors. An error message always waits for the user to acknowledge it with a keystroke. Type 5 allows you to write a message line on the line just above the bottom line of the screen. This is useful for writing instructions and then requesting user input (with function 14).

ax=11 – Insert Character String or Text Mark Inputs: bx = number of characters in the string cx,dx (far) = address of the string si = 0 => insert string 1 => insert text mark and hidden string Outputs: None Function: If si=0, the designated character string is inserted in front of the selection. The new selection is the first character of the old selection. If si=1, then a text mark is inserted into the file and the string passed as associated with the text mark is inserted as hidden text.

ax=12 – Get Selection Information Inputs: None Outputs: ax = selection mode 0 => character mode 1 => word mode 2 => line mode. bx = selection window identifier cx,dx (long) = first byte of the selection si,di (long) = last byte of the selection Function: This function gets information about the selection.

ax=13 – Set Selection Information Inputs: bx = input window identifier cx = new selection mode (must be 0, 1, or 2) Outputs: ax = 0 => command completed normally 1 => windowId was invalid (selection window was not changed) 2 => selection mode was out of range (selection mode was not changed). Function: This function changes the selection window and the selection mode. It will probably always be followed by a call to change the selection itself (function ax=6) since the selection limits in the old window are unlikely to be the correct ones for the new window.

ax=14 – Get User Input Inputs: bx = 0 => get a string terminated by Enter 1 => get a single character (no Enter required) cx,dx (far) = prompt string si,di (far) = default reply string Outputs: The string entered is copied into the prompt string (overwriting the prompt). The maximum length of the prompt, default, and reply strings is 80 characters Function: The prompt string is displayed on the bottom line of the display. The default reply string is entered as a suggested reply. Then the user can enter new input or accept the suggested input.

ax=15 – Get Window Location Inputs: bx = window identifier Outputs: ax = the row of the upper border of the window bx = the column of the left border of the window cx = the row of the lower border of the window dx = the column of the right border of the window si = 0 => command completed normally 1 => invalid window identifier

Function: This command gets the location on the screen of any window.

ax=16 – Get Window Information Inputs: bx = window identifier cx,dx (far) = address of the string for file name Outputs: The filename of the file in the window is copied into the string whose address was passed in (dx,cx) ax = the line number of the top line in the window bx = the line number of the bottom line in the window cx,dx (long) = the position of the first character showing in the window si,di (long) = position of the first character beyond the last character in the window

Function: This command gets information about any window.

ax=17 – Goto Line Number Inputs: bx = line number to go to Outputs: None Function: The active window is scrolled so that the designated line number is the top line in the window.

ax=18 – Move the Active Window Inputs: cx = the row of the new upper border of the window dx = the column of the new left border of the window si = the row of the new lower border of the window di = the column of the new right border of the window Outputs: None. Function: The active window is moved to the designated screen position.

ax=19 – Create New Window Inputs: cl = the row of the upper border of the new window ch = the column of the left border of the new window dl = the row of the lower border of the new window dh = the column of the right border of the new window si,di (far) = address of a string containing the filename of the file to load into the new window Outputs: ax = 0 => window create completed normally 1 => window create failed. bx = window identifier of the newly created window Function: A new window is created at the specified location with the specified file name. The new window becomes the active window.

ax=20 – Close the Active Window Inputs: bx = 0 => save the file in the window if it has been changed 1 => ask the user whether to save the file in the window if it has been changed 2 => do not save the file in the window even if it has been changed. Outputs: None Function: The active window is closed.

ax=21 – Save File in the Active Window Inputs: None Outputs: None Function: This call will save the file in the active window.

ax=22 – Get Identifier of the Next Window Inputs: bx = input window identifier Outputs: ax = 0 => function completed normally 1 => input window identifier was invalid. bx = window identifier of the next window below the input window identifier (in bx when the function is called) in the stack of windows; if the input window identifier was 0, then the window identifier of the top window is returned; if the output window identifier is 0 then the input window identifier was the bottom window.

Function: This function provides a way to look through the list of all open windows by scanning through from top to bottom. You start by sending in a 0 and getting the window identifier of the top window. Then call this function to get each window in turn, until a 0 is returned.

ax=23 – Convert a Line Number to a Character Position Inputs: bx = line number Outputs: cx,dx (long) = the low order 16 bits of the character position of the first character of the requested line number. Function: This function provides a way to convert from a line number to a character offset. Line numbers are used by language processors and other programs, but most of these interface functions use character positions.

ax=24 – Search for String Inputs: bl = value of ignoreCase for this search bh = value of searchMode for this search cx,dx (long) = offset part of the address of the search string Outputs: cx,dx (long) = the character position at which the string was found. If the string was not found these will both be -1

Function: This function gives you access to 's fast search command. It is much quicker than getting the text and searching it yourself, mainly because of the overhead of getting the text.

ax=25 – Execute a command Inputs: bx = window identifier cx = command number Outputs: ax = 0 => function completed normally 1 => input window identifier was invalid. Function: This function allows you to execute any command. The windowId is only used for those commands that take a window argument.

ax=26 – Get User Input Event Inputs: None. Outputs: bx = event type 1 => keyboard event 2 => mouse event cx = ASCII character (keyboard event) cx = mouse event mask (mouse event) dx = IBM PC keyboard scan code (keyboard event) dx = mouse button state (mouse event) si = vertical mouse coordinate (mouse event) di = horizontal mouse coordinate (mouse event) ax = mouse event identifier (mouse event)

Function: This function (along with the next one) allows you to run the main loop from an overlay program. This method would be used for programs that you want to load as overlays and keep loaded. They are essentially extensions to . Because it is not required to load the overlay to each time, the response will be faster. There are two kinds of events.

ax=27 – Handle Input Event Inputs: bx = event type (from function 26) cx = ASCII character (event type = 1) cx = mouse event identifier (event type = 2) dx = keyboard scan code (event type = 1) Outputs: None. Function: This function provides a means to pass input events back to so it can handle them.

ax=28 – Find Next File Mark Inputs: bx = input window identifier cx,dx (far) = address of the output string si, di = position from which to start looking Outputs: cx,dx (long) = character position of the text mark that was found (-1L if none found)

Function: This function searches in window w, starting at the start position, for a text mark (inserted using function 11). The location of the text mark is returned (-1L if none is found) and the (hidden) string associated with that text mark is placed in the output string.

ax=29 – Delete All Text Marks In a Window Inputs: bx = input window identifier Outputs: None. Function: This function removes all the (hidden) text markers from the file in window w.

ax=30 – User Menu Selection Inputs: cx = row of upper left corner of the menu dx = column of upper left corner of the menu si,di (far) = address of menu block Outputs: bx = number of the menu item selected. Function: This function displays a menu and lets the user select an item from the menu. The menu is positioned with its upper left corner at row cx and column dx. The address of a menu block is passed. This menu block defines the strings in the menu and the return values associated with each one. The file ``overlay.h'' contains a C structure definition of a menu block.

***The rest of this chapter is on the hard (paper) copy of pt200 but not in the file. I'm typing it in, but I don't know if you want it here or not.***

ax=31 – Reserved

ax=32 – Overlay suspend Inputs: None Outputs: cx,dx (far) = address of a string that will contain ``0'' if the overlay should exit. Function: This function is used to suspend an overlay. When an overlay is finished but wants to remain loaded, it makes this call. returns to its normal processing. When the overlay is called again, will notice that it is already loaded, and return from this function. The overlay can then continue without the overhead of having to load again. In addition, the overlay will retain all of its state information. This call is an alternative to running the main loop from the overlay. Primary and secondary overlays: For more support of overlays, we have made a distinction between primary and secondary overlays. The primary overlay is loaded and remains loaded for the duration of the editing session. The secondary overlays are transient overlays that are loaded after the primary overlay. If the overlay name is followed by a ``*'', it is marked as a primary overlay. Otherwise it is a secondary overlay.